
package com.netease.xone.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.netease.log.NTLog;
import com.netease.pkgRelated.XoneConsts;
import com.netease.xone.R;
import com.netease.xone.fragment.FragmentSubjectDetail;

public class ActivitySubjectDetail extends ActivityX1Base {

    public static void startActivity(Context context, int subjectId, String subjectName) {
        Intent i = new Intent(context, ActivitySubjectDetail.class);
        i.putExtra(XoneConsts.BUNDLE_KEY.SUBJECT_ID, subjectId);
        i.putExtra(XoneConsts.BUNDLE_KEY.SUBJECT_NAME, subjectName);
        context.startActivity(i);
    }

    public static final String TAG = "ActivitySubjectDetail";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int subjectId = getIntent().getIntExtra(XoneConsts.BUNDLE_KEY.SUBJECT_ID, -1);
        String subjectName = getIntent().getStringExtra(XoneConsts.BUNDLE_KEY.SUBJECT_NAME);
        if (subjectId < 0) {
            NTLog.e(TAG, "illegal subject id error! close ActivitySubjectDetail!");
            finish();
            return;
        }
        setContentView(R.layout.view_fragment_container);
        FragmentSubjectDetail fragment = FragmentSubjectDetail.newInstance(subjectId, subjectName);
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commit();
    }

}
